GtkApplicationWindow: Consistently unparent menubar
authorColin Walters <walters@verbum.org>
Fri, 2 Dec 2011 03:13:56 +0000 (22:13 -0500)
committerRyan Lortie <desrt@desrt.ca>
Mon, 19 Dec 2011 17:51:10 +0000 (12:51 -0500)
We create it floating, and don't hold an extra ref, so we should
just unparent it.

gtk/gtkapplicationwindow.c

index 31b3d9dbd62c1bce78378f714ec2ec8ea4876f10..68c39fd0c69e3904f61a4367226578535d36e646 100644 (file)
@@ -87,7 +87,6 @@ gtk_application_window_update_menubar (GtkApplicationWindow *window)
   if (have_menubar && !should_have_menubar)
     {
       gtk_widget_unparent (window->priv->menubar);
-      g_object_unref (window->priv->menubar);
       window->priv->menubar = NULL;
 
       gtk_widget_queue_resize (GTK_WIDGET (window));
@@ -503,7 +502,11 @@ gtk_application_window_dispose (GObject *object)
 {
   GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (object);
 
-  g_clear_object (&window->priv->menubar);
+  if (window->priv->menubar)
+    {
+      gtk_widget_unparent (window->priv->menubar);
+      window->priv->menubar = NULL;
+    }
   g_clear_object (&window->priv->actions);
 
   G_OBJECT_CLASS (gtk_application_window_parent_class)